package demo;

import java.util.Arrays;
import java.util.Random;

public class Test {
    public static void testQuickSort(int[] array) {
        array = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        TestDemo.quickSort(array,0,array.length-1);
        long endTime = System.currentTimeMillis();
        System.out.println("快速排序："+ (endTime-startTime));
    }


//    public static void testShellSort(int[] array) {
//        array = Arrays.copyOf(array,array.length);
//        long startTime = System.currentTimeMillis();
//        TestSort.shellSort(array);
//        long endTime = System.currentTimeMillis();
//        System.out.println("希尔排序："+ (endTime-startTime));
//    }
//
//    public static void testInsertSort(int[] array) {
//        array = Arrays.copyOf(array,array.length);
//        long startTime = System.currentTimeMillis();
//        TestDemo.insertSort(array);
//        long endTime = System.currentTimeMillis();
//        System.out.println("插入排序："+ (endTime-startTime));
//    }
//
//    public static void testSelectSort(int[] array) {
//        array = Arrays.copyOf(array,array.length);
//        long startTime = System.currentTimeMillis();
//        TestSort.selectSort(array);
//        long endTime = System.currentTimeMillis();
//        System.out.println("选择排序："+ (endTime-startTime));
//    }
//
//    public static void testHeapSort(int[] array) {
//        array = Arrays.copyOf(array,array.length);
//        long startTime = System.currentTimeMillis();
//        TestSort.heapSort(array);
//        long endTime = System.currentTimeMillis();
//        System.out.println("堆排序："+ (endTime-startTime));
//    }
//
//    public static void testBubbleSort(int[] array) {
//        array = Arrays.copyOf(array,array.length);
//        long startTime = System.currentTimeMillis();
//        TestSort.bubbleSort2(array);
//        long endTime = System.currentTimeMillis();
//        System.out.println("冒泡排序："+ (endTime-startTime));
//    }

    public static void main(String[] args) {
        int[] array = new int[1000000];
        Random random = new Random();
        //本身 并没有根本上解决 有序情况下  递归深度太深的情况---》根本上解决问题-》尽量让每次划分更均匀
        for (int i = 0; i < array.length; i++) {
            array[i] = i;
            //array[i] = random.nextInt(10_0000);-Xss2m
        }
        testQuickSort(array);
    }
}